﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<UI.Models.CategoryModel>" %>
<script src="http://maps.google.com/maps?file=api&v=1&key=ABQIAAAAniiRKIvksJcS5ll7TJ12shRw5_wBY-yiFXkinCvJCg5SJ7n-XBSzqiDZzFZXSo9mLZVULk8y-xC9fg"
    type="text/javascript"></script>
<%= UI.Helper.Utils.IncludeJS(this.Html, "~/Scripts/GMap.js") %>
<table width="307" cellspacing="0" cellpadding="0">
    <tr>
        <td>
            <table width="100%" cellspacing="0" cellpadding="0">
                <tr>
                    <td style="padding-top: 0px;">
                        <table width="100%" cellpadding="0" cellspacing="0">
                            <tbody>
                                <tr>
                                    <td valign="top" width="13" align="left">
                                        <img src="<%= Url.Content("~/Images/bg-menu-left.png")%>" width="13" height="46">
                                    </td>
                                    <td class="Bgmenu" height="46">
                                        <table width="100%" cellspacing="0" cellpadding="0">
                                            <tr>
                                                <td class="Title-white">
                                                    PHU DUY REAL ESTATE
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td valign="top" width="17" align="left">
                                        <img src="<%= Url.Content("~/Images/bg-menu-right.png")%>" width="17" height="46">
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td style="padding-top: 5px;">
                        <table width="100%" cellpadding="0" cellspacing="0" class="Table">
                            <tr>
                                <td height="" align="center" valign="top">
                                    <table width="94%" cellspacing="7" cellpadding="7">
                                        <% foreach (var tmp in Model.liCateGory)
                                           { %>
                                        <tr>
                                            <td class="Line-blue">
                                                <table width="100%" cellspacing="0" cellpadding="0">
                                                    <tr>
                                                        <td width="5%" align="left">
                                                            <img src="<%= Url.Content("~/Images/arrow-organe.gif")%>" width="4" height="7" />
                                                        </td>
                                                        <td width="95%" class="Submenu">
                                                            <%: Html.ActionLink(tmp.Name, "ListProductByCategory", new { controller = "Product", ID = tmp.Id }, new { @class = "Submenu" })%>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                        <% } %>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td style="padding-top: 10px;">
                        <table width="307" height="149" cellpadding="0" cellspacing="0" class="Table">
                            <tr>
                                <td align="left" valign="middle" background="<%= Url.Content("~/Images/icon-search.png")%>">
                                    <table width="100%" cellspacing="5" cellpadding="4">
                                        <tr>
                                            <td width="30%" class="Text-white-right">
                                                Tỉnh/Thành :
                                            </td>
                                            <td width="70%" class="Text-list" align="left">
                                                <% if (Model.Provinces.Count > 0)
                                                   {%>
                                                <%: Html.DropDownListFor(c => c.Provinces, new SelectList(Model.Provinces, "Id", "Name", Model.Provinces))%>
                                                <%} %>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="Text-white-right">
                                                Quận/Huyện :
                                            </td>
                                            <td width="70%" class="Text-list" align="left">
                                                <% if (Model.Districts.Count > 0)
                                                   {%>
                                                <%: Html.DropDownListFor(c => c.Districts, new SelectList(Model.Districts, "Id", "Name", Model.Districts))%>
                                                <%} %>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                &nbsp;
                                            </td>
                                            <td align="left">
                                                <input type="image" onclick="SubmitSearch();" name="imageField" id="imageField" src="<%= Url.Content("~/Images/bt-search.png")%>" />
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td style="padding-top: 10px;">
                        <table width="100%" cellspacing="0" cellpadding="0">
                            <tr>
                                <td>
                                    <%--<image src="<%= Url.Content("~/Images/map-01.gif")%>" width="307" height="241"></image>--%>
                                    <div id="mapDetail" style="width: 307px; height: 241px">
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td style="padding-top: 10px;">
                        &nbsp;
                    </td>
                </tr>
            </table>
            <script type="text/javascript">
                DrawMap('mapDetail', '<%= ConfigurationManager.AppSettings["Address1"] %>', true, '59/9B - PHẠM VIẾT CHÁNH - QUẬN 1 - TP. HCM');
            </script>
</table>
<script type="text/javascript">
    $('#Provinces').change(function () {
        $.getJSON('<%: Url.Content("~/Admin/Product/GetDistrictByProvinceLeft/") %>' + this.value, function (data) {
            var dropdownList = document.getElementById("Districts");
            dropdownList.options.length = 0;
            $.each(data, function (index, optionData) {

                var option = new Option(optionData.Text, optionData.Value);

                if ($.browser.msie) {
                    dropdownList.add(option);
                }
                else {
                    dropdownList.add(option, null);
                }
            });

        });

    });

    function SubmitSearch() {
        var province = $('#Provinces').val();
        var district = $('#Districts').val();
        location.href = '<%: Url.Content("~/Product/Search") %>' + '?province=' + province + '&district=' + district;
    }
</script>